/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import entity.FeedBack;
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Windows7
 */
public class TableFeedBack  extends AbstractTableModel{

    public static ArrayList<FeedBack> fb;
    private final String columnName[] = {"Fb_ID", "Customer_ID", "Fb_Customer", "Fb_Admin", "Status"};
    private final Class columnClass[] = {Integer.class, Integer.class, String.class, String.class, Integer.class};

    public TableFeedBack(ArrayList<FeedBack> fb) {
        this.fb = fb;
    }

    public TableFeedBack() {
        fb = new ArrayList<FeedBack>();
    }

    public int getRowCount() {
        return this.fb.toArray().length;
    }

    public int getColumnCount() {
        return columnName.length;
    }

    @Override
    public String getColumnName(int column) {
        return columnName[column];
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        switch (columnIndex) {
            case 1:
                return fb.get(rowIndex).getFb_Id();
            case 2:
                return fb.get(rowIndex).getCustomer_Id();
            case 3:
                return fb.get(rowIndex).getFb_Cus();
            case 4:
                return fb.get(rowIndex).getFb_Admin();
            case 5:
                return fb.get(rowIndex).getFb_Status();
            default:
                return null;
        }
    }
}
